<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />
	<link rel="icon" type="image/png" href="favicon.png">
<?php 

/** 	
	<!-- blueprint CSS framework -->
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css" media="screen, projection" />
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" />
	<!--[if lt IE 8]>
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css" media="screen, projection" />
	<![endif]-->
*/
?>	
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" />
<?php 

/** 	
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/form.css" />
 	*/
?>	
 	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/js/markitup/markitup/skins/simple/style.css" />
 	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/js/markitup/markitup/sets/utd_<?php echo Yii::app()->language; ?>/style.css" />

	
	<?php Yii::app()->clientScript->registerScriptFile("http://code.jquery.com/jquery-1.7.1.min.js", CClientScript::POS_END); ?>
	<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . "/js/markitup/markitup/jquery.markitup.js", CClientScript::POS_END); ?>
	<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . "/js/markitup/markitup/sets/utd_" . Yii::app()->language . "/set.js", CClientScript::POS_END); ?>
	
	<title><?php echo CHtml::encode($this->pageTitle); ?></title>
</head>

<body style="margin:5px">
	<?php 
	//Process database check an update
	DatabaseUpdater::checkAndUpdate(Yii::app()->params['version']);
	
	$configDetails = array();
	if (!Yii::app()->user->getId()) { $configDetails[] = array('label'=>Yii::t('view', 'Login'), 'url'=>array('/site/login'), 'icon' => 'icon-lock'); }
	if (!Yii::app()->user->getId()) { $configDetails[] = array('label'=>Yii::t('view', 'Register'), 'url'=>array('/user/create'), 'icon' => 'icon-user'); }
	if (Yii::app()->user->getId())  { $configDetails[] = array('label'=>Yii::t('view', 'Options'), 'url'=>array('/user/index'), 'icon' => 'icon-cog'); } 
	if (Yii::app()->user->getId())  { $configDetails[] = '---'; }
	if (Yii::app()->user->getId())  { $configDetails[] = array('label'=>Yii::t('view', 'Logout'), 'url'=>array('/site/logout'), 'icon' => 'icon-off'); }
	
	if (Yii::app()->user->getId()) {
		if (Yii::app()->user->lastName && Yii::app()->user->firstName) {
			$userName = Yii::app()->user->firstName . ' ' . Yii::app()->user->lastName;
		} else {
			$userName = Yii::app()->user->eMail;
		}
		
		$userOptions = array('label'=>$userName, 'url'=>'#', 'icon'=>'icon-user icon-white', 'items'=>$configDetails);
	} else {
		$userOptions = array('label'=>Yii::t('view', 'Login'), 'url'=>'#', 'icon'=>'icon-user icon-white', 'items'=>$configDetails);
	}
	
	?>
	<?php $this->widget('bootstrap.widgets.BootNavbar', array(
	    'fixed'=>false,
	    'brand'=>'universal-test-data',
	    'brandUrl'=>'#',
	    'collapse'=>false, 
	    'items'=>array(
	        array(
	            'class'=>'bootstrap.widgets.BootMenu',
	            'items'=>array(
	                array('label'=>Yii::t('view', 'Start'), 'url'=>array('/site/index'), 'icon'=>'icon-asterisk icon-white'),
	                array('label'=>Yii::t('view', 'History'), 'url'=>array('/history/index'), 'icon'=>'icon-time icon-white'),
	                array('label'=>Yii::t('view', 'Upload'), 'url'=>array('/upload/index'), 'icon'=>'icon-upload icon-white'),
	                array('label'=>Yii::t('view', 'Endpoints'), 'url'=>array('/endpoint/index'), 'icon'=>'icon-road icon-white'),
	            ),
	        ),
	        CHtml::beginForm(array('/history/index'), 'POST', array('class'=>'navbar-search pull-right')) . 
	        CHtml::textField('SearchForm[string]', null, array('id'=>'SearchForm_string', 'class'=>'search-query span2', 'placeholder'=>Yii::t('view', 'Search history'))) .
	        CHtml::endForm(),
	        array(
	            'class'=>'bootstrap.widgets.BootMenu',
	            'htmlOptions'=>array('class'=>'pull-right'),
	            'items'=>array(
	                array('label'=>Yii::t('view', 'Help'), 'url'=>array('/help'), 'icon'=>'icon-question-sign icon-white', 'htmlOptions'=>array('target' => '_blank'), 'active'=>$this->route == 'help/index'),
	                $userOptions,
	                array('label'=>Yii::t('view', 'Language'), 'url'=>'#', 'icon'=>'icon-flag icon-white', 'items'=>array(
	                    array('label'=>Yii::t('view', 'English'), 'url'=>array($this->route, 'locale'=>'en_us')),
	                    array('label'=>Yii::t('view', 'German'), 'url'=>array($this->route, 'locale'=>'de_de')),
	                    array('label'=>Yii::t('view', 'Polish'), 'url'=>array($this->route, 'locale'=>'pl_pl')),
	                )),
	            ),
	        ),
	    ),
	)); ?>
	<?php $this->widget('bootstrap.widgets.BootAlert'); ?>
	<div >
		<?php echo $content; ?>
	</div>
</body>

</html>
